<ui:composition template="/WEB-INF/templates/main-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
	
	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">
	
	
	 <h:form enctype="multipart/form-data" prependId="false">
	 <p:growl />
	 <h:outputText value="Refer a Profile" styleClass="outputTextTitle"/>
	 <h:panelGrid>
     <p:panel header="Upload New Resource(s)"> 
		   <h:panelGrid columns="8" style="border:0;" >	            
	           
	           <h:outputLabel value="*" style="color : red;" />
	           <h:outputLabel value="Candidate Name" />
	           <h:outputLabel value=" : " />
	           <p:inputText value="#{uploadCVDBProfilesBean.recruitmentProfile.candidateName}" />
	           
	           <h:outputLabel value="*" style="color : red;" />
	           <h:outputLabel value="Technology" />
	           <h:outputLabel value=" : " />
	           <p:selectOneMenu value="#{uploadCVDBProfilesBean.selectedTechnology}" style="width:160px;">
					<f:selectItems value="#{uploadCVDBProfilesBean.technologiesMap}" />
	           </p:selectOneMenu> 
	           
	           <h:outputLabel value="*" style="color : red;" />
	           <h:outputLabel value="Candidate Contact (+91)" />
	           <h:outputLabel value=" : " />
	            <p:inputMask value="#{uploadCVDBProfilesBean.recruitmentProfile.candidateMobileNumber}" mask="(999) 999-9999"/>
	           
	           <h:outputLabel value="*" style="color : red;"/>
	           <h:outputLabel value="Candidate Email" />
	           <h:outputLabel value=" : " />
	           <p:inputText value="#{uploadCVDBProfilesBean.recruitmentProfile.candidateEmail}" />
	           
	           <h:outputLabel value="*" style="color : red;"/>
	           <h:outputLabel value="Candidate Location" />
	           <h:outputLabel value=" : " />
	           <p:inputText value="#{uploadCVDBProfilesBean.recruitmentProfile.candidateCurrentLocation}" />
	           
	           <h:outputLabel value="*" style="color : red;"/>
	           <h:outputLabel value="Total Experience" />
	           <h:outputLabel value=" : " />
	           <p:inputText value="#{uploadCVDBProfilesBean.recruitmentProfile.candidateExperience}" maxlength="2" />	
	           
	           <h:outputLabel value="*" style="color : red;" />
	           <h:outputLabel value="Upload Resume"  />
	           <h:outputLabel value=" : " />
	           <p:fileUpload value="#{uploadCVDBProfilesBean.file}"  mode="simple" />
	           
	           <h:outputLabel value="" style="color : red;"/>
	           <h:outputLabel value="Remarks" />
	           <h:outputLabel value=" : " />
	           <p:inputTextarea value="#{uploadCVDBProfilesBean.recruitmentProfile.remarks}" autoResize="false" cols="17"/>
				
				<h:inputHidden /><p:commandButton value="Add" title="Add New Resource" action="#{uploadCVDBProfilesBean.createAnotherResourceAction}"  ajax="false" />
				
		   </h:panelGrid>
		   
		   <h:panelGrid>	
 		     <p:scrollPanel style="width:830px;height:300px" mode="native">   
				<p:dataTable value = "#{uploadCVDBProfilesBean.recruitmentProfiles}" var = "row" binding="#{uploadCVDBProfilesBean.assignedNewResourcesTable}">  
									
														
					<p:column headerText="Candidate Name">
						<p:cellEditor>
							<f:facet name="output">  
			                    <h:outputText  value="#{row.candidateName}"/>
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputText  value="#{row.candidateName}" style="width:100%"/>  
			                </f:facet>  							
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Candidate Contact">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.candidateMobileNumber}" />
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputText  value="#{row.candidateMobileNumber}" style="width:100px;"/>  
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Candidate Email">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.candidateEmail}" />
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputText  value="#{row.candidateEmail}" style="width:120px;"/>  
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Candidate Location">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.candidateCurrentLocation}" />
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputText  value="#{row.candidateCurrentLocation}" style="width:110px;"/>  
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Total Exp">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.candidateExperience}" />
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputText  value="#{row.candidateExperience}" style="width:50px;"/>  
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Remarks">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.remarks}" />
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputTextarea value="#{row.remarks}" rows="2" autoResize="false"/>  
			                </f:facet> 
						</p:cellEditor> 
					</p:column>
					
					<p:column headerText="Edit" style="width:50px">  
			            <p:rowEditor />  
			        </p:column>  
			        
					<p:column headerText="Operation" style="text-align: center; width: 30px;">		
						<p:commandButton icon="ui-icon-close" title="Remove from list"
							actionListener="#{uploadCVDBProfilesBean.removeRecruitmentResource}"
							update="@form" style="padding: 0"/>	
					</p:column>
					
		     </p:dataTable>
		   </p:scrollPanel>
		 </h:panelGrid>
 	    </p:panel>
	   
 	   
	      <p:commandButton value="Upload Resources"  actionListener="#{uploadCVDBProfilesBean.confirmationAction}" update="@form" style="float:right;"/>
		  </h:panelGrid>
		  
		  <p:confirmDialog widgetVar="confirmation" id="confirmation" severity="alert" message="This will upload profiles. Proceed?">
				<h:panelGroup style="text-align: right; float: right;">
					<p:commandButton value="Yes, upload Now" action="#{uploadCVDBProfilesBean.uploadResourcesAction}" update="@form" oncomplete="confirmation.hide()"/>
					<p:commandButton id="decline" value="Not Yet" onclick="confirmation.hide()" type="button" />
				</h:panelGroup>
			</p:confirmDialog>
     </h:form>
                    
                    
	</ui:define>
</ui:composition>

